
/**
 * @function: sql 语句
 * @description: 删除指定的表格数据
 * @author: allen
 * @version: 1.0.0
 * @param {*} params - sql
 */

const sqlMap = {
  Map: {

    // 初始化配置
    initConfig: 'SELECT * FROM config',
    // 用户相关
    getUser: 'SELECT * FROM user WHERE username = ? AND password = ? ',
    // 用户相关 Token
    getUserByToken: 'SELECT * FROM user WHERE token = ? ',
    // 所有数据的读写
    getTableList: 'SELECT * FROM tableinfo WHERE rw = "R"',
    // 仅写数据
    getWriteData: 'SELECT * FROM tableinfo WHERE rw = "W"',
    // 使用id更新写入数据
    setWriteData: 'UPDATE tableinfo set value = ? , date = ? WHERE id = ?',
    // 删除表数据
    delTableList: 'DELETE FROM tableinfo WHERE id = ? ',
    // 添加节点
    addNode: 'INSERT INTO tableinfo ("plc", "address", "type", "status", "rw", "property", "desc", "date") VALUES (?, ?, ?, ?, ?, ?, ?, ?)',
    // 趋势相关
    getTrendList: 'SELECT * FROM trend WHERE rw = "R"',
    // 添加趋势列表项
    addTrendList: 'INSERT INTO trend ("plc", "address", "type", "status","rw","factory","property","desc" ,"date") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)',
    // 删除趋势列表项
    delTrendList: 'DELETE FROM trend WHERE id = ? ',
    // 更新趋势列表项
    updateTrendList: 'UPDATE trend set factory = ?  WHERE id = ?',
    // 获取趋势项
    getTendItem: 'SELECT * FROM trend WHERE rw = "R"',

  }
}
module.exports = sqlMap
